'''
Created on Jan 22, 2010

@author: christianp
'''
import unittest
from BruTile.TileSchema import TileSchema
from BruTile.Extent import Extent

class UTileSchema(unittest.TestCase):

    tile_schema = TileSchema()

    def test_getters_setters(self):
        print("UTileSchema: test_getters_setters")
        self.tile_schema.set_name("test_tile_schema")
        self.tile_schema.set_src("test_src")
        self.tile_schema.set_extent(Extent(1,1,5,5))
        self.tile_schema.set_origin_x(5.5)
        self.tile_schema.set_origin_y(5.5)
        self.tile_schema.set_resolutions(["test1","test2","test3","test4","test5"])
        self.tile_schema.set_width(256)
        self.tile_schema.set_height(256)
        self.tile_schema.set_format("png")
        self.tile_schema.set_axis("axis_normal")
        
        self.assertEqual(self.tile_schema.get_name(), "test_tile_schema", "tile_schema.get_name()")
        self.assertEqual(self.tile_schema.get_src(), "test_src", "tile_schema.get_src()")
        
        extent = self.tile_schema.get_extent()
        self.assertEqual(extent.get_min_x(), 1, "extent.get_min_x()")
        
        self.assertEqual(self.tile_schema.get_origin_x(), 5.5, "tile_schema.get_origin_x()")
        self.assertEqual(self.tile_schema.get_origin_y(), 5.5, "tile_schema.get_origin_y()")
        
        resolutions = self.tile_schema.get_resolutions()
        self.assertEqual(len(resolutions), 5, "len(resolutions)")
        
        self.assertEqual(self.tile_schema.get_width(), 256, "tile_schema.get_width()")
        self.assertEqual(self.tile_schema.get_height(), 256, "tile_schema.get_height()")
        self.assertEqual(self.tile_schema.get_format(), "png", "tile_schema.get_format()")
        self.assertEqual(self.tile_schema.get_axis(), "axis_normal", "tile_schema.get_axis()")
        
        pass


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()